#include <iostream>
#include <unistd.h>

using std::cout;
using std::endl;

void fun()
{
    int *i = (int *)malloc(sizeof(int));
    *i = 10;
    if(fork()){
        *i = 1;
        printf("parent: %x, i = %d\n", i, *i);
    }else{
        printf("child: %x, i = %d\n", i, *i);
    }
}

int main(int args, char *argv[])
{
    fun();
    return 0;
}